<?php
	check_login();
	$a = getAction();

	switch($a) {
		case 'index':
			$sql = " select *  from " . table('user') . " order by id desc";
			$url="admin.php?m=user";

			$rscount=$db->getOne("select count(1) from ($sql) temp");
			$pagesize=20;
			$page=max(1,intval($_GET['page']));
			$start=($page-1)*$pagesize;
			$sql.=" limit $start,$pagesize";
			
			$list = $db->getAll($sql);

			$smarty->assign("pagelist",multipage($rscount,$pagesize,$page,$url));
			$smarty->assign("list", $list);

			$smarty->display("user.html");
			break;	
	}
    ?>